Skip to content

[release/2.11] Bump torchvision pin to ROCm/vision rocJPEG backport (ROCm/vision#10)#3411

Merged
jithunnair-amd merged 2 commits into
release/2.11from
ethanwee/rocjpeg-vision-pin-2.11
Jul 16, 2026
Merged

[release/2.11] Bump torchvision pin to ROCm/vision rocJPEG backport (ROCm/vision#10)#3411
jithunnair-amd merged 2 commits into
release/2.11from
ethanwee/rocjpeg-vision-pin-2.11

Conversation

@ethanwee1

@ethanwee1 ethanwee1 commented Jul 8, 2026

Copy link
Copy Markdown

What this does

Bumps the torchvision pin in related_commits for release/2.11 so ROCm PyTorch picks up rocJPEG GPU JPEG decoding.

  • torchvision | release/0.26: f37951448379bca5dfb29f6f345a80e721ea477c -> 8ced453e49d3cf57f8a713f13fc49bc0b513aa0d (ubuntu + centos lines). Repo/branch stay ROCm/vision / release/0.26.

The new commit is the backport of pytorch/vision#9342 (rocJPEG decode), adapted to the release/0.26 classic (non stable-ABI) layout.

Companion PR

torchvision backport: ROCm/vision#10

Validation

Built via TheRock "Multi-Arch Build Portable Linux PyTorch Wheels" against this branch: https://github.com/ROCm/TheRock/actions/runs/28960912700

  • Build (torch + rocJPEG torchvision, gfx94X, py3.12): success (cloned ROCm/pytorch at this branch, resolved vision via related_commits).
  • PyTorch test suite: 39627 passed; the only 4 failures are unrelated (test_unary_ufuncs.py uint8 threshold OverflowError), not JPEG/torchvision.

Points the release/2.11 torchvision pin at ROCm/vision#10
(backport of pytorch/vision#9342, rocJPEG GPU JPEG decode).
@rocm-repo-management-api

rocm-repo-management-api Bot commented Jul 8, 2026

Copy link
Copy Markdown

Jenkins build for b1b5e613dca78e172c41f90d2c6f8c5ca96d9ffa commit finished as FAILURE
Links: Pipeline Overview / Build artifacts / Test Results

Detected error during base docker image building:

#19 98.13 Verifying transaction: ...working... done
#19 98.43 Executing transaction: ...working... done
#19 98.78 + pip_install -r /opt/conda/requirements-ci.txt
#19 98.78 + as_jenkins conda run -n py_3.12 pip install --progress-bar off -r /opt/conda/requirements-ci.txt
#19 98.78 + sudo -E -H -u jenkins env -u SUDO_UID -u SUDO_GID -u SUDO_COMMAND -u SUDO_USER env PATH=/opt/conda/bin:/opt/conda/envs/py_3.12/bin:/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin LD_LIBRARY_PATH= conda run -n py_3.12 pip install --progress-bar off -r /opt/conda/requirements-ci.txt
#19 106.4   error: subprocess-exited-with-error
#19 106.4   
#19 106.4   × Getting requirements to build wheel did not run successfully.
#19 106.4   │ exit code: 1
#19 106.4   ╰─> [20 lines of output]
#19 106.4       Traceback (most recent call last):

@ethanwee1
ethanwee1 requested a review from jithunnair-amd July 16, 2026 15:25
jithunnair-amd pushed a commit to ROCm/vision that referenced this pull request Jul 16, 2026
…#9342) (#10)

## What this does

Backports rocJPEG GPU JPEG decoding (upstream **pytorch#9342**)
to `release/0.26`, so `decode_jpeg(..., device="cuda")` works on ROCm
(MI300 / gfx94X) using rocJPEG's hardware backend for `UNCHANGED`,
`GRAY`, and `RGB` modes. Gated by `TORCHVISION_USE_ROCJPEG` /
`ROCJPEG_FOUND`, alongside the existing nvJPEG CUDA path.

## Why this is a manual backport (not a cherry-pick)

`pytorch#9342` was merged against `main`, which has since diverged
significantly from `release/0.26`. A `git cherry-pick` does not apply.
The change had to be re-implemented against the `release/0.26` layout:

- **Stable ABI vs classic API:** upstream uses the torch stable ABI
(`torch::stable::Tensor`, `STABLE_TORCH_LIBRARY_IMPL`,
`common_stable.*`, the separate `image_stable` extension).
`release/0.26` has none of that, so the decoder was rewritten with the
classic `torch::Tensor` / `at::empty` / `TORCH_CHECK` API.
- **File placement / hipify:** upstream hand-writes
`io/image/hip/decode_jpegs_cuda.cpp`. On `release/0.26` the ROCm build
hipifies `io/image/cuda/*` into `hip/`, so the rocJPEG path lives in
`cuda/decode_jpegs_cuda.{cpp,h}` guarded by `#if ROCJPEG_FOUND` and
flows through hipify (verified: it transforms cleanly into
`hip/decode_jpegs_hip.cpp` with the `decode_jpegs_cuda` symbol and all
`rocJpeg*` calls intact).
- **Op registration:** `release/0.26` registers via a single
`.op("image::decode_jpegs_cuda", ...)` in `image.cpp`, so the upstream
dual `#if !ROCJPEG_FOUND` registration split was not needed.
- **setup.py:** added `USE_ROCJPEG` + `ROCJPEG_FOUND` detection to
`make_image_extension` (no `STABLE_SOURCES` / `image_stable` plumbing,
which don't exist here).

## Changes

- `torchvision/csrc/io/image/cuda/decode_jpegs_cuda.h` -
`RocJpegDecoder` class + `CHECK_ROCJPEG`/`CHECK_HIP` macros under `#if
ROCJPEG_FOUND`.
- `torchvision/csrc/io/image/cuda/decode_jpegs_cuda.cpp` - rocJPEG
decode implementation (classic API); stub guard changed to `#if
!NVJPEG_FOUND && !ROCJPEG_FOUND`.
- `setup.py` - `TORCHVISION_USE_ROCJPEG` / `ROCJPEG_FOUND` detection and
`rocjpeg` linkage.
- `test/test_image.py` - `IS_ROCM` tolerance bump for decode; skip GPU
JPEG *encoder* tests (rocJPEG is decode-only).
- `torchvision/io/image.py` - docstring note about the rocJPEG path.

## Capability notes

rocJPEG uses `ROCJPEG_BACKEND_HARDWARE`, which rejects images smaller
than 64x64 and 4:1:1 / unknown chroma subsampling.

## Validation

Built via TheRock "Multi-Arch Build Portable Linux PyTorch Wheels"
against this pin:
https://github.com/ROCm/TheRock/actions/runs/28960912700
- Build (torch + rocJPEG torchvision, gfx94X, py3.12): **success**.
- PyTorch test suite: 39627 passed; the only 4 failures are unrelated
(`test_unary_ufuncs.py` uint8 `threshold` OverflowError), not
JPEG/torchvision.

## Companion PR

Pin bump in ROCm/pytorch `release/2.11`: ROCm/pytorch#3411
Updates the release/2.11 torchvision pin to the merged ROCm/vision
release/0.26 commit 3d50b2155c02d26e78b9c09baf99f5c707d70215 (ROCm/vision#10).
@ethanwee1
ethanwee1 marked this pull request as ready for review July 16, 2026 17:21
@rocm-repo-management-api

rocm-repo-management-api Bot commented Jul 16, 2026

Copy link
Copy Markdown

Jenkins build for 7860bde06b74fda188068bcdb9c64286c14d7a1e commit finished as FAILURE
Links: Pipeline Overview / Build artifacts / Test Results

Detected error during base docker image building:

#19 215.0 Verifying transaction: ...working... done
#19 215.6 Executing transaction: ...working... done
#19 216.3 + pip_install -r /opt/conda/requirements-ci.txt
#19 216.3 + as_jenkins conda run -n py_3.12 pip install --progress-bar off -r /opt/conda/requirements-ci.txt
#19 216.3 + sudo -E -H -u jenkins env -u SUDO_UID -u SUDO_GID -u SUDO_COMMAND -u SUDO_USER env PATH=/opt/conda/bin:/opt/conda/envs/py_3.12/bin:/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin LD_LIBRARY_PATH= conda run -n py_3.12 pip install --progress-bar off -r /opt/conda/requirements-ci.txt
#19 226.5   error: subprocess-exited-with-error
#19 226.5   
#19 226.5   × Getting requirements to build wheel did not run successfully.
#19 226.5   │ exit code: 1
#19 226.5   ╰─> [20 lines of output]
#19 226.5       Traceback (most recent call last):

@jithunnair-amd
jithunnair-amd merged commit 6f68649 into release/2.11 Jul 16, 2026
0 of 2 checks passed
@jithunnair-amd
jithunnair-amd deleted the ethanwee/rocjpeg-vision-pin-2.11 branch July 16, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants